/**
 * @summary 频道模块
 * @author 志鹏
 * @descreption ...
 */

import * as channelApi from '@/api/channel'

export default {
  // 我是模块
  namespaced: true,
  state: {
    // 频道列表
    channelList: [],
  },
  mutations: {
    SET_CHANNEL_LIST(state, newValue) {
      state.channelList = newValue
    }
  },
  actions: {
    async updateChannelList({ commit }) {
      // 发请求
      // 拿到数据
      const res = await channelApi.getChannelList()
      // 把数据传给mutation
      // mutation改数据
      commit('SET_CHANNEL_LIST', res)
    }
  }
}
